package iterator;


public class ArrayList<E> {
	private Object[] elements; 
	private int size = 0;
	public ArrayList(int apacity) {
		elements = new Object[apacity];
	}
	public ArrayList() {
		this(10);
	}
	public E get(int index) {
		return (E) elements[index];
	}
	public Iterator<E> iterator() {
		return new ListIterator();
	}
	public void add(Object object) {
		elements[size++] = object;
	}
	public int size() {
		return size;
	}
	class ListIterator implements Iterator<E> {
		
		private int cursor;
		public boolean hasNext() {
			if (cursor != size()) return true;
			return false;
		}

		public E next() {
			E e = get(cursor);
			cursor ++;
			return e;
		}
	}
}
